package com.demo.designmode.combination;

/**
 * @Author: jxm
 * @Description: 菜单项类，属于叶子结点
 * @Date: 2023-11-17 10:27
 * @Version: 1.0
 */
public class MenuItem extends MenuComponent{

    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("--");
        }
        //菜单项名称
        System.out.println(name);
    }
}
